<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/23 0023
 * Time: 15:40
 */

namespace app\admin\controller\mall;


use app\common\controller\AdminController;
use think\facade\View;

class IntegralItem extends AdminController
{
    public function initialize()
    {
        parent::initialize();
        $this->model = app('app\common\model\mall\IntegralItem');
    }
    /**
     * 列表
     */
    public function get_where($arr = []){
        $array=[];
        if(isset($arr['title']) && !empty($arr['title'])){
            $array[] = ['title','like','%'.$arr['title'].'%'];
        }
        return $array;
    }
    /**
     * 详情页
     */
    public function get_edit(){
        $id = $this->request->param('id');
        $row = $this->model->with(['Sku'])->find($id);
        View::assign('row',$row);
        return View::fetch('edit');
    }

    /**
     * 获取验证规则
     * @param $post
     * @return array
     */
    public function get_check_rule($post)
    {
        $rule = [
            'attribute|商品属性'   => 'require',
            'thumb|商品主图'   => 'require',
            'image|商品轮播图'   => 'require',
        ];

        return $rule;
    }
}